<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <span>姓名:</span>
        <span class="name"></span>
    </div>
    <div>
        <span>年龄:</span>
        <span class="age"></span>
    </div>
    <div>
        <span>性别:</span>
        <span class="sex"></span>
        <button onclick="fn1()">后退</button>
    </div>
</body>
<script>
    var url = window.location.href
    var arrStr = url.split("?")[1].split('&');
    console.log(arrStr);
    var userName = document.querySelector('.name');
    userName.innerHTML = arrStr[0].split('=')[1];
    var age = document.querySelector('.age');
    age.innerHTML = arrStr[1].split('=')[1];
    var sex = document.querySelector('.sex');
    sex.innerHTML = arrStr[2].split('=')[1] == '1' ? '男' : '女';

    function fn1() {
        history.back();
        //history.go(-1)
    }
</script>

</html>